var windowWidth = document.documentElement.clientWidth;

var windowHeight = document.documentElement.clientHeight;
//浏览器中心点横坐标
var centerX = windowWidth/2;
//浏览器中心点纵坐标
var centerY = windowHeight/2;

$("#xc div").each(function(){
    var x = Math.random()*800-400;
    x = Math.floor(x);//取整
    x=centerX +x-75;
    var y = Math.random()*400-200;
    y = Math.floor(y);//取整
    y=centerY +y-75;

    $(this).css("left",x+"px");
    $(this).css("top",y+"px");

    //随机生成角度
    // var angle = Math.random()*60-30;
    // angle = Math.floor(angle);
    //避免不转
    var angle = Math.random()*40;
    angle=angle>20?angle+20:angle;
    angle -= 30;

    //设置旋转
    $(this).css("transform","rotate("+angle+"deg)");
});

$("#xc div a").fancybox();

